/**
 * 0053
 *  
 * @Author : Ruoyu Wang
 * @DateTime : 2024/10/16 11:10
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Solution {
public:
    int maxSubArray(vector<int> &nums) {
        vector<int> f(nums.size(), 0);
        int res = -0x3f3f3f3f;
        for (int i = 0; i < nums.size(); ++i) {
            f[i] = nums[i];
            if (i > 0) {
                f[i] += max(f[i - 1], 0);
            }
            res = max(res, f[i]);
        }
        return res;
    }
};

int main() {

    return 0;
}